<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<script>
    ws = new WebSocket("ws://47.93.19.32:8080");
    ws.onopen = function() {
        console.log("连接成功");

        console.log("给服务端发送一个字符串：tom");
    };
    ws.onmessage = function(e) {
        var o = {};
        o['sid'] = "f4959e9f5ccd290ad0b75bdfacbbebad";
        o['message'] = 1;
        //o['code'] = [601003,601001];
        ws.send(JSON.stringify(o));
        console.log("收到服务端的消息：" + e.data);
    };
</script>

</body>
</html>